#!/data/usr/local/python3/bin/python3
import string

input_data = open("../data/document.txt")
output_data = open("../data/document_new.txt",'w')
delset = string.punctuation
for line in input_data.readlines():
    word_list = line.strip().split()
    print("word_list: ",word_list) 
    for word in word_list:
        temp_str = ''
        if word.isalpha():
            print("word: ",word)
            output_data.write(word.lower())
            output_data.write(" ")
        else:
            if "'" in word:
                output_data.write(word.lower().replace("'"," i"))
            else:
                for s in word:
                    if s.isalpha():
                        temp_str += s
            print("temp_str: ",temp_str)
            output_data.write(" ")
            output_data.write(temp_str.lower())
            output_data.write(" ")
    output_data.write('\n')

input_data.close()
output_data.close()
